<?php
/**
 * Created by PhpStorm.
 * User: warcello
 * Date: 2016/10/13
 * Time: 下午3:34
 */
class communeModule extends Module
{
    /*
    * 在构造函数中装载所依赖的类或其他文件
   */
    function __construct()
    {
        $this->includePhp('commune', 'commune');
    }

    /*
    * 调用插件资源
   */
    public function call($user, $method, $param)
    {
        switch ($method) {
            case "communeIndex":
                commune::communeIndex($param);
                break;
            case "communeGroupAdd": //新增社群
                $gid = $param->id;
                $groupname  = $param->groupname;
                $groupcount = $param->groupcount;
                if (!isset($groupname)||!isset($groupcount)) {
                    Output::instance()->resultCode(code_lackof_param);
                    return;
                }
                commune::communeGroupAdd($gid,$groupname,$groupcount);
                break;
            case "communeGroupView": //社群列表
                commune::communeGroupView();
                break;
            case "communeGroupList": //社群列表
                commune::communeGroupList($param->start, $param->limit);
                break;
            case "communeGroupInfo": //社群详情
                $id = $param->id;
                commune::communeGroupInfo($id);
                break;
            case "communeHotUserList": //社群活跃用户列表
                $id = $param->id;
                commune::communeHotUserList($id,$param->start, $param->limit);
                break;
            case "comuneRankList":   //排行榜
                commune::comuneRankList($param->start,$param->limit);
                break;
            case "communeShareView": //社群分享
                $gid = $param->gid;

                commune::communeShareView($gid);
                break;
            case "updateShareTime"://更新分享时间

                $gid = $param->gid;
                commune::updateShareTime($gid);
                break;

            case "communeDeleteGroup"://删除
                $gid = $param->gid;
                commune::communeDeleteGroup($gid);
                break;
            case "communeSign": //签到
                $gid = $param->gid;
                commune::communeSign($gid);
                break;
        }
    }

}
$module = new communeModule();
Module::addModule($module);
